//-----------------------------------------------------------------------------
// Filename: TemplateController.cs
//
// Description: 
// A template (empty shell) controller class that has the methods that will
// be called in the controller stage.
//
// History:
// 04 Oct 2004	Aaron Clauson	Created.
//
// License: 
// Public Domain.
//-----------------------------------------------------------------------------

using System;
using System.Collections;
using System.Text.RegularExpressions;
using System.Web;
using System.Xml;
using MaverickLite.Aza.Model;
using MaverickLite.Config;
using MaverickLite.Controller;
using log4net;

namespace MaverickLite.Aza.Controller
{
	/// <summary>
	/// This controller is empty and is a template to implement other controllers.
	/// </summary>
	public class TemplateController : XmlController
	{
		/// <summary>
		/// The constructor gets called when the web app is first loaded and not everytime a request
		/// uses the controller. use the constructor to parse out any parameters from the config file and
		/// do any common set up tasks.
		/// </summary>
		/// <param name="initParams">The XML node within the controller in the config file. The controller
		/// is repsonsible for building its own view and model maps. If the base constructor is not called
		/// the controller needs to build up the view and model stages based on this XML.</param>
		public TemplateController(XmlElement initParams) : base(initParams)
		{}

		/// <summary>
		/// Typically the request data will be initialised here along with any other initialisation or 
		/// set up type tasks. Not required to be implemented.
		/// </summary>
		/// <param name="context">The incoming HTTP request.</param>
		protected override void InitialiseRequest(HttpContext context)
		{		
			logger.Debug("TemplateController InitialiseRequest.");
			
			m_view = "success";	
		}

		/// <summary>
		/// Useful for doing checks before any heavy work is undertaken in case the client should 
		/// be sent elsewhere or some work avoided. If not used return null or don't override.
		/// </summary>
		/// <returns>A url that indicates that a client side redirect response should be sent.</returns>
		public override string Perform()
		{
			return null;
		}

		/// <summary>
		/// Template method that should be used to construct the page specific model for the request.
		/// If nothing extra needs to be added to the model over and above what's contained in the configuration
		/// file then don't override this method.
		/// </summary>
		public override void BuildPageModel()
		{
			// Do nothing.
		}


		/// <summary>
		/// If any extra logic needs to be used to select the view it can be done here. In a lot of
		/// cases the view may already be set so this call is not needed. Return null if overridden and
		/// not used or just don't override.
		/// </summary>
		public override string GetView()
		{
			return null;
		}
	}
}
